﻿<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="UnionTypes" targetNamespace="http://kis.x-road.eu/"
		   xmlns="http://kis.x-road.eu/" 
           xmlns:mstns="http://kis.x-road.eu/"
		   xmlns:xs="http://www.w3.org/2001/XMLSchema">

  <xs:simpleType name="simpleType1">
    <xs:restriction base="xs:integer" >
      <xs:maxExclusive value="35"></xs:maxExclusive>
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="SimpleUnion">
    <xs:union memberTypes="xs:string xs:integer simpleType1">
      <xs:simpleType>
        <xs:restriction base="xs:dateTime"></xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>
   
  <xs:simpleType name="DerivedSimpleUnion">
    
    <xs:restriction base="SimpleUnion">
      
    </xs:restriction>
    
  </xs:simpleType>
  <xs:simpleType name="DerivedSimpleUnion2">

    <xs:restriction base="DerivedSimpleUnion">
      <xs:pattern value="[a-zA-Z0-9-]+"></xs:pattern>
      <xs:enumeration value="2001-01-01T00:00:00.0000000">
        <xs:annotation>
          <xs:appinfo>
            <![CDATA[Ainult kuupäev]]>
          </xs:appinfo>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="7">
        <xs:annotation>
          <xs:appinfo>
            <![CDATA[Integer 7]]>
          </xs:appinfo>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="kindel string">
        <xs:annotation>
          <xs:appinfo>
            <![CDATA[Kindel string]]>
          </xs:appinfo>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>

  </xs:simpleType>

  <xs:simpleType name="AnonymousSimpleUnion">
    
    <xs:union memberTypes="SimpleUnion DerivedSimpleUnion" >
      
      <xs:simpleType>
        <xs:restriction base="xs:integer">
          <xs:minInclusive value="0"/>
          <xs:maxInclusive value="100"/>
        </xs:restriction>
      </xs:simpleType>
      <xs:simpleType>
        <xs:restriction base="xs:integer">
          <xs:minInclusive value="300"/>
          <xs:maxInclusive value="400"/>
        </xs:restriction>
      </xs:simpleType>

    </xs:union>
  </xs:simpleType>

</xs:schema>